﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;

public static class VNConvert
{
	public static String ToAscii(this String vn)
	{
        String s = vn.ToLower();
        s = Regex.Replace(s, "[áàảạãăắằẳặẵâấầậẩẫ]", "a");
        s = Regex.Replace(s, "[éèẻẽẹêếềểễệ]", "e");
        s = Regex.Replace(s, "[đ]", "d");
        s = Regex.Replace(s, "[íìỉĩị]", "i");
        s = Regex.Replace(s, "[úùủũụưừứửữự]", "u");
        s = Regex.Replace(s, "[óòỏõọôốồổỗộơớờởỡợ]", "o");
        s = Regex.Replace(s, "\\s+", "-");
        s = Regex.Replace(s, "---", "-");
        s = Regex.Replace(s, "--", "-");
        s = Regex.Replace(s, "/", "-");
        return s;
	}
}